
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module cr.message
* @author: Hjava
* @description: 直播聊天室消息内包
* @since: 2018-07-21 16:45:03
*/
var cr_constant_1 = __webpack_require__(/*! _chatroom/cr.constant */ "./src/core/chatroom/cr.constant.ts");
var protocol_1 = __webpack_require__(/*! _util/protocol */ "./src/core/utils/protocol.ts");
var byteBuffer_1 = __webpack_require__(/*! _util/byteBuffer */ "./src/core/utils/byteBuffer.ts");
var bufferType_1 = __webpack_require__(/*! _util/bufferType */ "./src/core/utils/bufferType.ts");
var constant_1 = __webpack_require__(/*! _util/constant */ "./src/core/utils/constant.ts");
var CRMessage = {};
CRMessage.CRTextMessage = protocol_1.default.Response.extend({
    category: 'LIVE',
    __type: constant_1.CR_MESSAGE_TYPE.CR_MSG_TYPE_TEXT,
    uri: cr_constant_1.default.CR.URI_CR_MSG_TEXT,
    init: function () {
        this.text = '';
    },
    marshall: function () {
        this.push(this.text, bufferType_1.default.STRING);
    },
    unmarshall: function () {
        this.text = this.popString();
    }
});
CRMessage.CRFaceMessage = protocol_1.default.Response.extend({
    category: 'LIVE',
    __type: constant_1.CR_MESSAGE_TYPE.CR_MSG_TYPE_FACE,
    uri: cr_constant_1.default.CR.URI_CR_MSG_FACE,
    init: function () {
        this.category = '';
        this.type = '';
        this.name = '';
    },
    marshall: function () {
        this.push(this.category, bufferType_1.default.STRING);
        this.push(this.type, bufferType_1.default.STRING);
        this.push(this.name, bufferType_1.default.STRING);
    },
    unmarshall: function () {
        this.category = this.popString();
        this.type = this.popString();
        this.name = this.popString();
    }
});
CRMessage.CRLikeMessage = protocol_1.default.Response.extend({
    category: 'LIVE',
    __type: constant_1.CR_MESSAGE_TYPE.CR_MSG_TYPE_LIKE,
    uri: cr_constant_1.default.CR.URI_CR_MSG_LIKE,
    init: function () {
        this.times = 0;
    },
    marshall: function () {
        this.push(this.times, bufferType_1.default.INT);
    },
    unmarshall: function () {
        this.times = this.popInt();
    }
});
CRMessage.CRCustomMessage = protocol_1.default.Response.extend({
    category: 'LIVE',
    __type: constant_1.CR_MESSAGE_TYPE.CR_MSG_TYPE_CUSTOM,
    uri: cr_constant_1.default.CR.URI_CR_MSG_CUSTOM,
    init: function () {
        this.data = [];
    },
    marshall: function () {
        this.push(byteBuffer_1.default.strToBytes(this.data), bufferType_1.default.BYTES);
    },
    unmarshall: function () {
        var buffer = this.popBytes();
        this.data = (new byteBuffer_1.default(buffer)).readUTF8String(buffer.byteLength);
    }
});
exports.default = CRMessage;


//# sourceURL=webpack://MTDX/./src/core/chatroom/cr.message.ts?